;;;; William Behrens' Emacs config

;;; Buffer specific vars, can be changed per buffer
(setq inhibit-startup-message t) ; Do not show the startup screen.
(setq show-paren-delay 0)
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
;(setq auto-save-default nil)

;;; Global vars, enforced across all buffers
(setq-default truncate-lines t) ; Disable line wrap globally
(setq-default mouse-wheel-scroll-amount '(3 ((shift) . 3))) ; three lines at a time
(setq-default mouse-wheel-progressive-speed nil) ; don't accelerate scrolling
(setq-default mouse-wheel-follow-mouse 't) ; scroll window under mouse
(setq-default scroll-step 1) ; keyboard scroll one line at a time
(setq-default electric-indent-inhibit t) ; Fixes auto indents
     
;;; Four space tabbing... finally
(setq-default indent-tabs-mode nil
              tab-width 4) 
(setq c-set-style "k&r" ; what other styles are there?
      c-basic-offset 4)

;;; Set Emacs modes
(electric-pair-mode t) ; Auto pairs
(show-paren-mode t) ; Auto pairs
(scroll-bar-mode -1) ; Disables scroll bar.
(tool-bar-mode -1) ; Disables tool bar
(menu-bar-mode -1) ; Disables menu bar
(tooltip-mode -1) ; Disables tooltip bar
;(global-whitespace-mode 0) ; What is this?

;;; Mode hooks
(add-hook 'prog-mode-hook 'linum-mode) ; Only enable line nums in code buffers
(set-face-attribute 'default nil  :height 85)
;(set-frame-font "GoMono Nerd Font" nil t) ; set default font
(set-frame-font "JetBrains Mono Nerd Font" nil t) ; set default font
;(set-frame-font "Fira Code Mono Nerd Font" nil t) ; set default font

;;;;;;;;;;;;;;;;;;;;;
;;; Setup package ;;;
;;;;;;;;;;;;;;;;;;;;;
(require 'package) ; require Emacs package manager
(setq package-archives
      '(("elpa" . "https://elpa.gnu.org/packages/")
        ("melpa" . "https://melpa.org/packages/")
        ("org" . "https://orgmode.org/elpa/"))
      use-package-always-ensure t)
(package-initialize)
(unless package-archive-contents (package-refresh-contents)) ; If the packages isn't archived sync with repos
(unless (package-installed-p 'use-package) (package-install 'use-package)) ; If not installed install use-package
(require 'use-package) ; require use-package

(load "~/.emacs.d/keybinds.el")
(load "~/.emacs.d/ide.el")
(load "~/.emacs.d/filetypes.el")
(load "~/.emacs.d/themes.el")

;;;;
;;; Org mode stuff
;;;;
;;
(require 'org)
(setq org-log-done t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Magit: Git integration with Emacs ;;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Docs: https://github.com/magit/magit
(use-package magit
	:ensure t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Projectile: Project management in Emacs ;;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Docs: 
(use-package projectile
  :ensure t
  :config
  (projectile-mode +1))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Neotree: File tree explorer ;;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Docs: 
(use-package neotree
  :ensure t
  :config
  (require 'neotree)
  (setq neo-smart-open t)
  (setq projectile-switch-project-action 'neotree-projectile-action)
  (setq neo-theme (if (display-graphic-p) 'icons 'arrow)))

;;; DO NOT EDIT!
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages
   '(ox-groff dap-java straight neotree projectile magit doom-modeline doom-themes cider slime lsp-java meson-mode dap-mode flycheck tree-sitter-langs tree-sitter company-box company lsp-ui lsp-mode evil-collection evil use-package)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
